/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.unicauca.opentextbook.controladores;

import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ViewScoped;
import org.primefaces.event.TabChangeEvent;

/**
 *
 * @author ADM_JMARTINEZ
 */
@ManagedBean(name = "generalController")
@ViewScoped
public class GeneralController implements Serializable {

    @ManagedProperty("#{objetivoController}")
    private ObjetivoController objetivoController;
    @ManagedProperty("#{tareaController}")
    private TareaController tareaController;

    public void onTabChange(TabChangeEvent event) {
        if ("tabObjetivos".equals(event.getTab().getId())) {
            objetivoController.consultarObjetivos();
        } else if ("tabObjetivosPorCubrir".equals(event.getTab().getId())) {
            objetivoController.cargarObjetivosPorCubrir();
        } else if ("tabTareas".equals(event.getTab().getId())) {
            tareaController.consultarTareas();
        } else {
            tareaController.cargarTareasPorCubrir();
        }
    }

    public ObjetivoController getObjetivoController() {
        return objetivoController;
    }

    public void setObjetivoController(ObjetivoController objetivoController) {
        this.objetivoController = objetivoController;
    }

    public TareaController getTareaController() {
        return tareaController;
    }

    public void setTareaController(TareaController tareaController) {
        this.tareaController = tareaController;
    }
}
